package com.liruo.treasureattic.common.model.enume;

import com.liruo.enumconverter.model.SourceEnum;
import com.liruo.treasureattic.common.model.constant.TreasureAtticConstant;
import lombok.AllArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author:liruo
 * @Date:2022-12-13-19:38:03
 * @Desc
 */
@AllArgsConstructor
public enum HtmlImportSelectionEnum implements Serializable, SourceEnum<Integer> {

    TO_DEFAULT_FOLDER(0,"把解析结果直接放到默认folder下"),
    TO_NEW_FOLDER(1,"把解析结果直接放到新建的folder下"),
    SELF_ADJUST(2,"- 进行自我调整(把上传的与当前的进行重组)后再重新上传保存-结果返回后，前端应该再请求所有folder，这些folder会有点击就查询url的功能"),
    SELF_ADJUST_REUPLOAD(3, "自我调整的重新上传变化后的father关系的folder和url保存");
    private final Integer value;
    private final String description;
    public static HtmlImportSelectionEnum select(Integer selection){
        return switch (selection){
            case 0 -> TO_DEFAULT_FOLDER;
            case 1 -> TO_NEW_FOLDER;
            case 2 -> SELF_ADJUST;
            case 3 -> SELF_ADJUST_REUPLOAD;
            default -> throw new RuntimeException("not match HtmlImportSelection");
        };
    }
    @Serial
    private static final long serialVersionUID = TreasureAtticConstant.TREASURE_ATTIC_VERSION;

    @Override
    public Integer source() {
        return this.value;
    }

    public String getDescription() {
        return description;
    }

}
